<template>
	<view class="user_info">
		<view class="main">
			<view class="img">
				<image :src="userInfo.thumbnail" mode="widthFix"></image>
			</view>
			<view class="info">
				<view class="">
					<view class="user_name">
						<text>{{userInfo&&userInfo.nickName||'--'}}</text>
					</view>
					<view class="qy">
						<text>所在企业：{{userInfo&&userInfo.belongRehabCenter||'--'}}</text>
					</view>
				</view>
				<view class="ss">
					<view class="se">
						<uni-data-select :clear="false" v-model="value" :localdata="range" @change="change"></uni-data-select>
					</view>
					<view class="dy">
						<text>订阅+</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapMutations
	} from 'vuex';
	import { getuinfo,gettoken } from '@/request/api.js'
	export default {
		data() {
			return {
				value: 0,
				info:'',
				range: [],
			}
		},
		created(){
			this.getuinfo()
		},
		methods: {
			...mapMutations(['setToken']),
			async getuinfo() {
				let res = await getuinfo();
				console.log(res.data.ridlist[0])
				this.info =  res.data
				this.range = res.data.alist
				this.value = parseInt(res.data.ridlist[0])
			},
			async gettoken(e) {
				let res = await gettoken({id:e});
				this.setToken(res.data)
				this.value = parseInt(e)
				console.log(res.data)
			},
			change(e) {
				console.log("e:", e);
				this.gettoken(e)
			},
		}
	}
</script>
<style lang="scss" scoped>
	
.main {
	display: flex;
	justify-content: flex-start;
	align-items: flex-start;
	.img {
		width: 100rpx;
		margin-right: 30rpx;
		border-radius: 50%;
		overflow: hidden;
	}
	.user_name {
		font-weight: bold;
		color: #3D3D3D;
		line-height: 45rpx;
	}
	.qy {
		color: $text-grey;
		font-size: 25rpx;
		margin-top: 4rpx;
		color: #979797;
		line-height: 45rpx;
	}
	.info {
		flex: 1;
		display: flex;
		justify-content: space-between;
		.ss {
			margin-top: 10rpx;
			width: 260rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.se {
				width: 120rpx;
				
			}
			.dy {
				width: 120rpx;
				height: 70rpx;
				background-color: #092b80;
				display: flex;
				justify-content: center;
				align-items: center;
				color: #fff;
				border-radius: 7rpx;
			}
		}
		/deep/ .uni-select {
			border: 0;
		}
		.uni-select {
			border: 0;
		}
	}
	
}
</style>
